<script>
function confirmEnding(str, target) {
  // 请把你的代码写在这里
  const start = str.length - target.length
  const arr = str.substr(start, target.length)
  if (arr === target) {
    return true
  }
  return false
}

const allComponents = require.context('./control/components', true, /\.vue$/)
const myComponents = {}
allComponents.keys().forEach(fileName => {
  if (confirmEnding(fileName, '.vue')) {
    const splitList = fileName.split('/')
    const comp = allComponents(fileName)
    myComponents[splitList[splitList.length - 1].replace('.vue', '')] = comp.default
  }
})
// console.log(myComponents)
export default {
  name: 'TopoBase',
  components: myComponents
}
</script>
